<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html 
     PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
     "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html>
<head>
  <title>reject_friend (FriendshipsController)</title>
  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
  <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
</head>
<body class="standalone-code">
  <pre><span class="ruby-comment cmt"># File friendships_controller.rb, line 63</span>
        <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">reject_friend</span>
                <span class="ruby-identifier">friendship1</span> = <span class="ruby-constant">Friendship</span>.<span class="ruby-identifier">find_by_user_a_id_and_user_b_id</span>(<span class="ruby-identifier">current_user</span>.<span class="ruby-identifier">id</span>,<span class="ruby-identifier">params</span>[<span class="ruby-identifier">:id</span>])
                <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">friendship1</span> <span class="ruby-operator">!=</span> <span class="ruby-keyword kw">nil</span> <span class="ruby-keyword kw">and</span> <span class="ruby-identifier">friendship1</span>.<span class="ruby-identifier">status</span> <span class="ruby-operator">==</span> <span class="ruby-value">3</span>
                        <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">friendship1</span>.<span class="ruby-identifier">destroy</span>
                                
                                <span class="ruby-identifier">friendship2</span> = <span class="ruby-constant">Friendship</span>.<span class="ruby-identifier">find_by_user_a_id_and_user_b_id</span>(<span class="ruby-identifier">params</span>[<span class="ruby-identifier">:id</span>],<span class="ruby-identifier">current_user</span>.<span class="ruby-identifier">id</span>)
                                <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">friendship2</span> <span class="ruby-operator">!=</span> <span class="ruby-keyword kw">nil</span> <span class="ruby-keyword kw">and</span> <span class="ruby-identifier">friendship2</span>.<span class="ruby-identifier">status</span> <span class="ruby-operator">==</span> <span class="ruby-value">2</span>
                                        <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">friendship2</span>.<span class="ruby-identifier">destroy</span>
                                                <span class="ruby-identifier">redirect_to</span> <span class="ruby-identifier">:controller</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value str">&quot;users&quot;</span>, <span class="ruby-identifier">:action</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value str">&quot;home&quot;</span>, <span class="ruby-identifier">:id</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">current_user</span>.<span class="ruby-identifier">id</span>
                                        <span class="ruby-keyword kw">end</span>
                                <span class="ruby-keyword kw">end</span>
                        <span class="ruby-keyword kw">end</span>
                <span class="ruby-keyword kw">end</span>   
        <span class="ruby-keyword kw">end</span></pre>
</body>
</html>